// components/test5/test5.js
const myBehaviors = require('../../behaviors/my-behaviors.js')
import {
  storeBindingsBehavior
} from 'mobx-miniprogram-bindings'
import {
  store
} from '../../store/store'
Component({
  behaviors: [ storeBindingsBehavior,myBehaviors],
  storeBindings: {
    store,
    fields: {
      numA: 'numA',
      numB: 'numB',
      sum: 'sum'
    },
    actions: {
      updataNum2: 'updateNum2'
    }
  },
  /**
   * 组件的属性列表
   */
  properties: {
    count: {
      type: Number,
      value: 1
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    // username:'测试'
  },
  // lifetimes:{
  //   created() {
  //     console.log(111111);
  //   }
  // },
  /**
   * 组件的方法列表
   */
  methods: {
    addCount() {
      this.setData({
        count: this.properties.count + 1
      })
      this.triggerEvent('sync', {
        value: this.properties.count
      })
    },
    //组件使用store
    btnHeader2(e) {
      this.updataNum2(e.target.dataset.step)
    }
  }
})